import { fromJS } from 'immutable'

export default {

  setSwiper(state, action) {
    // js转为immutable对象
    let data = fromJS(action.payload)
    // 追加数据
    return state.updateIn(['swiper'], item => item.concat(data))
  },

  setSwiper2(state, action) {
    // js转为immutable对象
    let data = fromJS(action.payload)
    // 追加数据
    return state.updateIn(['swiper2'], item => item.concat(data))
  },

  setRecommend(state, action) {
    // js转为immutable对象
    let data = fromJS(action.payload)
    // 追加数据
    return state.updateIn(['Recommend'], item => item = data )
  },

  setList(state, action) {
    // js转为immutable对象
    let data = fromJS(action.payload)
    // 追加数据
    return state.updateIn(['List'], item => item = data )
  },

  setRecommend2(state, action) {
    // js转为immutable对象
    let data = fromJS(action.payload)
    // 追加数据
    return state.updateIn(['Recommend2'], item => item = data )
  },

//追漫
  setCartoon(state, action) {
    // js转为immutable对象
    let data = fromJS(action.payload)
    // 追加数据
    return state.updateIn(['cartoon'], item => item.concat(data))
  },
  //详情
  setDetail(state, action) {
    // js转为immutable对象
    let data = fromJS(action.payload)
    // 追加数据
    return state.updateIn(['detail'], item => item = data)
  },
  //书架
  setDetail2(state, action) {
    // js转为immutable对象
    let data = fromJS(action.payload)
    // 追加数据
    return state.updateIn(['detail2'], item => item.push(data))
  }
}